package example;

import jakarta.servlet.ServletContextAttributeEvent;
import jakarta.servlet.ServletContextAttributeListener;
import jakarta.servlet.annotation.WebListener;

@WebListener
public class MyServletContextAttributeListener implements ServletContextAttributeListener {
    @Override
    public void attributeAdded(ServletContextAttributeEvent event) {
        System.out.println("监听到ServletContext对象中存数据了");
    }

    @Override
    public void attributeRemoved(ServletContextAttributeEvent event) {
        System.out.println("监听到ServletContext对象中删除数据了");
    }

    @Override
    public void attributeReplaced(ServletContextAttributeEvent event) {
        System.out.println("监听到ServletContext对象中替换数据了");
    }
}
